penguins <- read_csv("penglings.csv")
## New names:
## Rows: 344 Columns: 9
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (3): species, island, sex dbl (6): ...1, bill_length_mm, bill_depth_mm,
## flipper_length_mm, body_mass_g...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
penguin_plot <- penguins %>%
  mutate(bill_area_mm = bill_length_mm * bill_depth_mm) %>% 
ggplot(aes(x = flipper_length_mm, y = body_mass_g, text = paste("Species:", species, "<br>Bill Area (mm²):", bill_area_mm))) +
  geom_point(aes(color=species, size= bill_length_mm, shape=species), alpha = 0.8) +
  scale_color_manual(values = c("darkorange","darkorchid","cyan4")) +
  scale_size_continuous(name = "Bill Length (mm)", guide = guide_legend()) +
  scale_shape_manual(values = c(16, 19, 9)) +
  facet_wrap(. ~ sex, labeller = label_both) +
  labs(title = "Penguin Metrics",
       x = "Flipper Length (mm)",
       y = "Body Mass (g)") 
penguin_plot_int <- ggplotly(penguin_plot, tooltip="text") %>%
  layout(showlegend = TRUE, 
         legend = list(orientation = "v", x = 1.05, y = 0.5))
penguin_plot_int